package com.lvyq.javaprint.util;

import javafx.stage.Screen;
import javafx.stage.Stage;

/**
 * @author lvyq
 * @version 1.0
 * Create by 2024-04-24 16:01
 */
public class StageUtils {
    /**
     * @description 窗口右下角
     * @author lvyq
     * @throws
     * @time 2024-04-24 15:58
     */
    public static void  rightBottomWindow(Stage primaryStage){
        //禁止改变窗口大小
        primaryStage.setResizable(false);
        // 获取主屏幕的宽度和高度
        Screen primaryScreen = Screen.getPrimary();
        double screenWidth = primaryScreen.getVisualBounds().getWidth();
        double screenHeight = primaryScreen.getVisualBounds().getHeight();
        // 设置窗口的初始位置为屏幕右下角
        primaryStage.setX(screenWidth - primaryStage.getWidth());
        primaryStage.setY(screenHeight - primaryStage.getHeight());

    }
}
